package com.zfx.beandefinition;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.stereotype.Component;

//程序员提供的后置处理器，验证禁止所有的bean 属性填充
//@Component
public class MyInstantiationAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor , BeanPostProcessor {

	// postProcessAfterInstantiation


	@Override
	public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
		if (beanName.equals("xService")){
			System.out.println(beanName +" 类禁止属性注入");
			return false;
		}
		return true;
	}
}
